package org.example.demo.exception;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class ExceptionController {
    @ExceptionHandler(value = {NullPointerException.class})
    public String error(Exception e, Model model) {
        model.addAttribute("exception", e);
        return "error";
    }
}
